<?php
class Categories_model extends CI_Model{
    
    private $_table='categories';
    
    public function get_categories(){
        $this->db->order_by('name','asc');
        $query=$this->db->get($this->_table);
        return $query->result_array();
    }
    
    public function get_category_where($params=array()){
        $where='( 1 )';
        if(!empty($params['id']))
            $where.=' AND (id='.$params['id'].')';
        $this->db->order_by('name','asc');
        $query=$this->db->get_where($this->_table,$where);
        return $query->result_array();
    }
    
    
    
}

